/**
 * jims
 */
package com.jims.master.modules.doctor.service;

import com.jims.master.common.persistence.Page;
import com.jims.master.common.service.CrudService;
import com.jims.master.modules.doctor.dao.ApplyDrugWithdraDao;
import com.jims.master.modules.doctor.entity.ApplyDrugWithdra;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * ApplyDrugWithdraService
 * @author zp
 * @version 2017-07-21
 */
@Service
@Transactional(readOnly = true)
public class ApplyDrugWithdraService extends CrudService<ApplyDrugWithdraDao, ApplyDrugWithdra> {

	public ApplyDrugWithdra get(String id) {
		return super.get(id);
	}
	
	public List<ApplyDrugWithdra> findList(ApplyDrugWithdra applyDrugWithdra) {
		return super.findList(applyDrugWithdra);
	}
	
	public Page<ApplyDrugWithdra> findPage(Page<ApplyDrugWithdra> page, ApplyDrugWithdra applyDrugWithdra) {
		return super.findPage(page, applyDrugWithdra);
	}
	
	@Transactional(readOnly = false)
	public int save(ApplyDrugWithdra applyDrugWithdra) {
		return super.save(applyDrugWithdra);
	}
	
	@Transactional(readOnly = false)
	public int delete(ApplyDrugWithdra applyDrugWithdra) {
		return super.delete(applyDrugWithdra);
	}


	@Transactional(readOnly = false)
	public int saveApplyDrugWithdra(ApplyDrugWithdra applyDrugWithdra) {
		applyDrugWithdra.preInsert();
		applyDrugWithdra.setRetType("1");
		applyDrugWithdra.updateOrgId();
		int num = dao.insert(applyDrugWithdra);
		return num;
	}
	@Transactional(readOnly = false)
	public int saveApplyDrugWithdraAll(List<ApplyDrugWithdra> applyDrugWithdraList) {
		int num = 0;
		for (ApplyDrugWithdra applyDrugWithdra1:applyDrugWithdraList){
			applyDrugWithdra1.preInsert();
			applyDrugWithdra1.setRetType("1");
			applyDrugWithdra1.updateOrgId();
			num += dao.insert(applyDrugWithdra1);
		}
		return num;
	}

}